﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ZenSystemService.Api.Migrations
{
    /// <inheritdoc />
    public partial class LegencyUser : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "LegencyUserZenUsers",
                columns: table => new
                {
                    LegencyUserZenUserId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    LegencyUserId = table.Column<int>(type: "int", nullable: false),
                    ZenUserId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LegencyUserZenUsers", x => x.LegencyUserZenUserId);
                    table.ForeignKey(
                        name: "FK_LegencyUserZenUsers_Users_ZenUserId",
                        column: x => x.ZenUserId,
                        principalTable: "Users",
                        principalColumn: "UserId",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_LegencyUserZenUsers_ZenUserId",
                table: "LegencyUserZenUsers",
                column: "ZenUserId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "LegencyUserZenUsers");
        }
    }
}
